/**
 * http://usejsdoc.org/
 * @class index_server
 */
var io = require("socket.io").listen(8080,{log:false});
io.sockets.on('connection',function(socket){//启动socket服务
	
	socket.on('msg',function(data){//监听socket消息
		console.log(data);
		/**根据state,向客户端发送不同的消息*/
		if(data.state){
			if(data.state === 'success'){
				socket.emit('msg',{'me':'very good'});
			}else{
				socket.emit('msg',{other:'that is all'});
			}
		}else{
			socket.emit('msg',{other:'that is all'});
		}
	});
});